﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CarErp.Model;

namespace CarErp.Forms.Controls
{
	public partial class CarPurchaseApprovalView : UserControl
	{
		public CarPurchaseApprovalView()
		{
			InitializeComponent();
		}

		public void Reset()
		{
			Model = null;

			textBox_Comment.Text = "";
			dateTimePicker_ApprovalTime.Value = DateTime.Now;
		}

		public void SetModel(CarPurchaseApprovalPaper model)
		{
			Model = model;

			textBox_Comment.Text = model.Comment;
			dateTimePicker_ApprovalTime.Value = model.ApprovalTime;
		}

		public CarPurchaseApprovalPaper GetModel()
		{
			var result = Model ?? new CarPurchaseApprovalPaper();

			result.Comment = textBox_Comment.Text;
			result.ApprovalTime = dateTimePicker_ApprovalTime.Value;

			return result;
		}

		private CarPurchaseApprovalPaper Model;
	}
}
